package com.example.minzhengtong.ui

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.GridLayoutManager
import com.example.minzhengtong.R
import com.example.minzhengtong.base.BaseFg
import com.example.minzhengtong.databinding.FragmentFourBinding
import com.zhy.adapter.recyclerview.CommonAdapter
import com.zhy.adapter.recyclerview.base.ViewHolder

/**
 * created by WY on 2021/5/27.
 */
class FourFG : BaseFg() {

    companion object {
        @JvmStatic
        fun newInstance(param1: String = "", param2: String = "") =
            FourFG().apply {
                arguments = Bundle().apply {
                }
            }
    }

    private lateinit var binding : FragmentFourBinding
    private val mData = mutableListOf("省直","福州","厦门","漳州","泉州","兰明","莆田","南平","龙岩","宁德","平潭")
    private val mAdapter by lazy {
        FourAdapter()
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentFourBinding.inflate(inflater)
        return binding.root
    }

    override fun initView() {
        binding.recyclerView.apply {
            layoutManager = GridLayoutManager(baseContext,3)
            adapter = mAdapter
        }
    }

    override fun initListener() {

    }

    override fun lazyLoad() {

    }

    inner class FourAdapter : CommonAdapter<String>(baseContext, R.layout.item_four,mData){
        override fun convert(holder: ViewHolder?, t: String?, position: Int) {
            holder?.setText(R.id.text,t)
        }
    }

}